package com.dataeco.api.security;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

@Service
public class SecurityAuthenticationFacade implements AuthenticationFacade {
    @Override
    public Authentication getAuthentication() {
        return SecurityContextHolder.getContext().getAuthentication();
    }

    @Override
    public SecurityUserDetails getUserDetails() {
        return (SecurityUserDetails) getAuthentication().getPrincipal();
    }
}
